﻿namespace PropertyManagementWebApi.Helpers
{
    public static class ConfigurationHelper
    {
        private static IConfiguration? _configuration;

        // 在应用启动时初始化配置
        public static void Initialize(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        // 获取配置节
        public static string GetSection(string section, string key)
        {
            if (_configuration == null)
                throw new InvalidOperationException("ConfigurationHelper未初始化");

            return _configuration[$"{section}:{key}"] ?? string.Empty;
        }
    }
}
